<?php
namespace app\blog\form;

use app\common\loglic\Form;

class Index extends Form
{
    public function items($data=[])
    {
        return [
            'detail_user' => [
                'type'            => 'hidden',
                'value'           => $data['detail_user'],
            ],
            'detail_id' => [
                'type'            => 'hidden',
                'value'           => $data['detail_id'],
            ],
            'detail_name' => [
                'type'        => 'text',
                'value'       => $data['detail_name'],
                'required'    => true,
                'title'       => '主标题',
                'class_row'   => 'col-6 mb-3',
                'class_label' => 'form-label',
            ],
            'detail_title' => [
                'type'        => 'text',
                'value'       => $data['detail_title'],
                'required'    => false,
                'title'       => '副标题',
                'class_row'   => 'col-6 mb-3',
                'class_label' => 'form-label',
            ],
            'detail_slug' => [
                'type'        => 'text',
                'value'       => $data['detail_slug'],
                'required'    => false,
                'title'       => '固定链接',
                'class_row'   => 'col-6 mb-3',
                'class_label' => 'form-label',
            ],
            'type_id' => [
                'type'        => 'list-check',
                'value'       => $data['type_id'],
                'option'      => model('blog/Type','loglic')->listOptionLevel(0),
                'required'    => false,
                'title'       => '栏目分类',
                'class_row'   => 'col-2 mb-3 col-type',
                'class_label' => 'form-label',
            ],
            'tag_id' => [
                'type'        => 'list-check',
                'value'       => $data['tag_id'],
                'option'      => model('blog/Tag','loglic')->listIdsOption($data['tag_id'],config('channel.limitAdminTag')),
                'url'         => xfUrl('blog/admin.tag/auto'),
                'required'    => false,
                'title'       => '标签TAG',
                'class_row'   => 'col-4 mb-3 col-tag',
                'class_label' => 'form-label',
            ],
            'detail_slide' => [
                'type'        => 'image',
                'value'       => $data['detail_slide'],
                'required'    => false,
                'title'       => '横版封面',
                'thumb'       => array_merge(explode(',',config('upload.thumb_slide')),['name'=>'slide']),
                'class_row'   => 'col-6 mb-3',
                'class_label' => 'form-label',
            ],
            'detail_cover' => [
                'type'        => 'image',
                'value'       => $data['detail_cover'],
                'required'    => true,
                'thumb'       => array_merge(explode(',',config('upload.thumb_cover')),['name'=>'cover']),
                'title'       => '竖版封面',
                'class_row'   => 'col-6 mb-3',
            ],
            'detail_content' => [
                'type'        => 'editor',
                'value'       => $data['detail_content'],
                'required'    => true,
                'title'       => '文章内容',
                'rows'        => 30,
                'thumb'       => array_merge(explode(',',config('upload.thumb_editor')),['name'=>'editor']),
                'class_row'   => 'col-6 mb-3',
                'class_label' => 'fw-bold',
            ],
            'detail_ai' => [
                'type'        => 'editor',
                'value'       => $data['detail_ai'],
                'required'    => false,
                'title'       => '改写内容',
                'rows'        => 30,
                'thumb'       => array_merge(explode(',',config('upload.thumb_editor')),['name'=>'editor']),
                'class_row'   => 'col-6 mb-3',
                'class_label' => 'fw-bold',
            ],
            'detail_excerpt' => [
                'type'        => 'textarea',
                'value'       => $data['detail_excerpt'],
                'required'    => false,
                'title'       => '内容摘录',
                'rows'        => 3,
                'class_row'   => 'col-6 mb-3',
                'class_label' => 'form-label',
            ],
            'detail_description' => [
                'type'        => 'textarea',
                'value'       => $data['detail_description'],
                'required'    => false,
                'title'       => 'SEO描述',
                'rows'        => 3,
                'class_row'   => 'col-6 mb-3',
                'class_label' => 'form-label',
            ],
            'detail_extend[password]' => [
                'type'        => 'text',
                'value'       => $data['detail_extend']['password'],
                'required'    => false,
                'title'       => '私密笔记密码',
                'class_row'   => 'col-3 mb-3',
                'class_label' => 'form-label',
            ],
            'detail_extend[passurl]' => [
                'type'        => 'text',
                'value'       => $data['detail_extend']['passurl'],
                'required'    => false,
                'title'       => '密码寄售链接',
                'class_row'   => 'col-3 mb-3',
                'class_label' => 'form-label',
            ],
            'detail_keywords' => [
                'type'        => 'text',
                'value'       => $data['detail_keywords'],
                'required'    => false,
                'title'       => 'SEO关键字',
                'class_row'   => 'col-3 mb-3',
                'class_label' => 'form-label',
            ],
            'detail_tpl' => [
                'type'        => 'text',
                'value'       => $data['detail_tpl'],
                'required'    => false,
                'title'       => '自定义模板名称',
                'class_row'   => 'col-3 mb-3',
                'class_label' => 'form-label',
            ],
            'detail_status' => [
                'type'        => 'select',
                'value'       => $data['detail_statu'],
                'option'      => model('common/Attr','loglic')->status(),
                'title'       => '状态',
                'class_row'   => 'col-1 mb-3',
                'class_label' => 'form-label',
            ],
            'detail_top' => [
                'type'        => 'select',
                'value'       => intval($data['detail_top']),
                'option'      => model('common/Attr','loglic')->bool(),
                'title'       => '置顶',
                'class_row'   => 'col-1 mb-3',
                'class_label' => 'form-label',
            ],
            'detail_recommend' => [
                'type'        => 'select',
                'value'       => intval($data['detail_recommend']),
                'option'      => model('common/Attr','loglic')->bool(),
                'title'       => '推荐',
                'class_row'   => 'col-1 mb-3',
                'class_label' => 'form-label',
            ],
            'detail_weight' => [
                'type'        => 'select',
                'value'       => intval($data['detail_weight']),
                'option'      => model('common/Attr','loglic')->weight(),
                'title'       => '权重',
                'class_row'   => 'col-1 mb-3',
                'class_label' => 'form-label',
            ],
            'detail_view' => [
                'type'        => 'text',
                'value'       => $data['detail_view'],
                'required'    => false,
                'title'       => '人气值',
                'class_row'   => 'col-1 mb-3',
                'class_label' => 'form-label',
            ],
            'detail_letter' => [
                'type'        => 'text',
                'value'       => $data['detail_letter'],
                'required'    => false,
                'title'       => '首字母',
                'maxlength'   => 1,
                'class_row'   => 'col-1 mb-3',
                'class_label' => 'form-label',
            ],
            'detail_referer' => [
                'type'        => 'text',
                'value'       => $data['detail_referer'],
                'required'    => false,
                'title'       => '来源网址',
                'class_row'   => 'col-6 mb-3',
                'class_label' => 'form-label',
            ],
        ];
    }
}